#include<iostream>
#include<list>
#include<deque>
#include<algorithm>

using namespace std;
struct Display{
	void operator()(int i){
		cout<< i <<"";
	}
};

int main()
{
	list<int> aList = {1,2,3,4,5,6,7,8,9};
	deque<int> d1,d2;
	for(auto& w : aList){
		if(w & 1) {
			d1.push_back(w);
			
		}else{
			d2.push_back(w);
		}
	}
	
	for_each(d1.begin(),d1.end(),Display());
	cout<<endl;
	for_each(d2.begin(),d2.end(),Display());
	
} 
